// const moment = require('moment-business-days');
// import moment from 'moment-business-days';
// const ins = require('express');
// import ins  from 'express'
// let a = ins.Router()
if (typeof window !== 'undefined') {
  console.log('运行环境是浏览器');
  } else {
  console.log('运行环境不是浏览器');
  }
if (typeof process !== 'undefined') {
  console.log('运行环境是Node.js');
  } else {
  console.log('运行环境不是Node.js');
  }

function calculate() {
  
  var user_input = parseInt(document.getElementById("inputAmount").value);
  let result = 0;
  let Sum_50 = 0; //大于10w 小于50w
  let Sum_100 = 0; //大于50w 小于100w
  let Sum_200 = 0; //大于100w 小于200w
  let Sum_500 = 0; //大于200w 小于500w
  let Sum_1000 = 0; //大于500w 小于1000w
  let Sum_1001 = 0; //大于1000w
  //-----------------------------------
  let Sum1_50 = 0; //大于10w 小于50w
  let Sum1_100 = 0; //大于50w 小于100w
  let Sum1_200 = 0; //大于100w 小于200w
  let Sum1_500 = 0; //大于200w 小于500w
  let Sum1_1000 = 0; //大于500w 小于1000w
  let Sum1_1001 = 0; //大于1000w
  
  // const MAX=100000;



 // 大于10w 小于  100亿
 if (user_input >= 100000 && user_input <= 10000000000) {
  // 小于50w
  if (user_input > 10000000) {
    Sum_1001 = (user_input - 10000000) * 0.001;
    Sum1_1001 = (user_input - 10000000);

    console.log(Sum_1001);
    Sum_1000 = (10000000-5000000) * 0.002
    Sum_500 = (5000000-2000000) * 0.004
    Sum_200 = (2000000-1000000) * 0.006
    Sum_100 = (1000000-500000) * 0.008
    Sum_50 = (500000-100000) * 0.01
    result = Sum_1001 + Sum_1000+Sum_500+Sum_200+Sum_100+Sum_50

  }else if(user_input>= 5000000 ){
    Sum_1000 = (user_input-5000000) * 0.002
    Sum1_1000 = (user_input-5000000) 

    console.log("Sum_1000=",Sum_1000);
    Sum_500 = (5000000-2000000) * 0.004
    Sum_200 = (2000000-1000000) * 0.006
    Sum_100 = (1000000-500000) * 0.008
    Sum_50 = (500000-100000) * 0.01
    result = Sum_1000+Sum_500+Sum_200+Sum_100+Sum_50
  }else if(user_input>= 2000000 ){
    
    Sum_500 = (user_input-2000000) * 0.004
    Sum1_500 = (user_input-2000000) 
    console.log("Sum_500=",Sum_500);

    Sum_200 = (2000000-1000000) * 0.006
    Sum_100 = (1000000-500000) * 0.008
    Sum_50 = (500000-100000) * 0.01
    result = Sum_500+Sum_200+Sum_100+Sum_50
   }else if(user_input>= 1000000 ){
    Sum_200 = (user_input-1000000) * 0.006
    Sum1_200 = (user_input-1000000) 
    console.log("Sum_200=",Sum_200);

    Sum_100 = (1000000-500000) * 0.008
    Sum_50 = (500000-100000) * 0.01
    result = Sum_200+Sum_100+Sum_50

   }else if(user_input>= 500000 ){
    Sum_100 = (user_input-500000) * 0.008
    Sum1_100 = (user_input-500000)
    console.log("Sum_100=",Sum_100);

    Sum_50 = (500000-100000) * 0.01
    result = Sum_100+Sum_50
  
   }else if(user_input>= 100000 ){
    Sum_50 = (user_input-100000) * 0.01
    Sum1_50 = (user_input-100000)
    console.log("Sum_50=",Sum_50);
    result = Sum_50
  
   }



} else {
  document.getElementById("result").innerHTML =
    "请输入正确的金额范围（10万到一百亿）！";
    
  return;
}
//小于50w
document.getElementById("result_50").innerHTML = Sum_50;
//小于100w
document.getElementById("result_100").innerHTML = Sum_100;
//小于200w
document.getElementById("result_200").innerHTML = Sum_200;
//小于500w
document.getElementById("result_500").innerHTML = Sum_500;
//小于1000w
document.getElementById("result_1000").innerHTML = Sum_1000;
//超过1000w
document.getElementById("result_10001").innerHTML = Sum_1001;
//最终值
// -------------------------------------------------------
//小于50w
document.getElementById("result1_50").innerHTML = Sum1_50;
//小于100w
document.getElementById("result1_100").innerHTML = Sum1_100;
//小于200w
document.getElementById("result1_200").innerHTML = Sum1_200;
//小于500w
document.getElementById("result1_500").innerHTML = Sum1_500;
//小于1000w
document.getElementById("result1_1000").innerHTML = Sum1_1000;
//超过1000w
document.getElementById("result1_10001").innerHTML = Sum1_1001;
//最终值
//-------------------------------------------------
document.getElementById("result").innerHTML = result;
}


